1. Field of the Invention
The present invention relates to a data conversion apparatus for converting index data to real data and to an image generation apparatus for converting, for example, index texture data to real texture data by the data conversion to make it possible to suitably carry out texture mapping.
2. Description of the Related Art
When storing a large amount of data such as, for example, image data in a computer or other processing apparatus, to make effective use of the limited storage region of the apparatus, it is preferable to reduce the amount of data stored. As a general method for reducing the amount of data for this purpose, there is the method of using index data.
In this method, actual data (hereinafter referred to as xe2x80x9cactual dataxe2x80x9d or xe2x80x9creal dataxe2x80x9d) is given a number expressed by a smaller bit width than the data bit width. By storing data by such numbers, it is possible to store the data by a smaller amount of data than that by directly storing the actual data. The numbers given to the actual data are referred to as xe2x80x9cindexesxe2x80x9d, and the data converted to a format referred to by indexes is referred to as xe2x80x9cindex dataxe2x80x9d.
When using index data, it is necessary to store both a list establishing correspondence between the index data and the real data, that is, an index table and the data expressed by the index data in the processing apparatus. However, usually the decrease of the amount of data caused due to the use of the index data is overwhelmingly larger than the increase of the amount of data caused due to the storage of the index table, therefore the amount of data can be greatly reduced as a whole.
When the method of storage using index data is applied to image data, the image data is stored in the form of index data inside the processing apparatus. When displaying the image data on a display or otherwise outputting the image data to the outside, the index data is converted to real data for output. The conversion of the index data to the real data must be carried out at a high speed in accordance with, for example, the speed of display of the display device. Therefore, usually this data conversion processing is frequently carried out by data conversion apparatus constituted by hardware.
Specifically, the data conversion apparatus is constituted by using, for example, a memory. When the index is input as an address, the converted real data is output as the output data.
An example of such a data conversion apparatus constituted by a memory is shown in FIGS. 1A and 1B.
FIG. 1A is a view of a data conversion apparatus constituted by a memory for converting 3-bit index data to 32-bit real data. The content of the index data stored in this memory is shown in FIG. 1B.
In a field of computer graphics, color image data consisting of a very large amount of data is processed, therefore processing by xe2x80x9cindex colorxe2x80x9d expressing color data using indexes is frequently utilized.
xe2x80x9cProcessing by index colorxe2x80x9d means processing which defines index color data of for example 4 bits, 8 bits, and 16 bits for real color data of 24 bits comprised by for example 8 bits each of R, G and B by the number of required specified colors, maintains an index table corresponding to the index color data, and converts index color data to real color data.
For processing using computer graphics, there are many applications where there are no problems in actual use even if used while limiting the number of colors. In such a case, processing by index color is being used even more.
A data conversion apparatus for converting this index color data to real color data at a high speed is referred to as a xe2x80x9ccolor look-up tablexe2x80x9d since it converts color data.
When using such index data, the types of usable data are limited by the number of entries of the index table. However, in some applications, there are cases where it is desired to use a larger amount of data than the number of entries of the index table. Therefore, in such a case, the methods of rewriting the index table for use or providing a plurality of index tables and using the same by switching in accordance with the situation are usually used. The method of rewriting of the index table, however, causes a reduction in the processing speed by an amount corresponding to the rewriting time. Therefore, in general the method of providing many index tables within a range allowed by the storage region of the memory of the data conversion apparatus is adopted.
Even if a plurality of index tables are provided due to such a method, there is no change in the fact that the types of data which can be used at each point of time are limited by the number of entries of the selected index table, but by providing many index tables and using them by appropriately switching in a series of continuous processing, substantially a large amount of data is used when seen from the standpoint of the application.
In this way, in processing by index data, provision of many index tables is becoming one of the most important factors in actual use.
Further, when using such index data, the bit width of the data output from the index table, that is, the precision of the index table, is also becoming important.
The requests on the data precision of an index table differ according to application. There are a variety of requests. For example, some require data precision, while others do not. When taking as an example the field of computer graphics, in CADs for graphic design, for example, the ability to display fine differences in the tone of colors is very important for designers and a high precision is required for the data of the index table. In the case of CADs for mechanical design, however, it is sufficient so far as parts can be discriminated by color and fine differences of colors of individual parts are not so important.
In this way, in processing using index data, the number of entries and the precision of the index table are very important items.
In the data conversion apparatuses heretofore, however, there has been a one-to-one correspondence between entries and addresses of the memory. The precision of the index table has corresponded to the data bit width of the memory and has been substantially fixed, so could not be adjusted corresponding to the application etc.
For this reason, there are many cases where the precision of the index table is set in advance so as to become a precision that can be also applied to applications for which a relatively high precision is required. Namely, in many cases each data has a certain longer bit width. As a result, even in a case of use with an application where not that high a precision is required, the processing is carried out with an index table having a precision of more than required.
Further, the number of entries is preferably made as large as possible, but an increase of the number of entries leads to an increase of the capacity of the memory which ends up being used. Therefore usually it cannot be sufficiently increased in many cases.
Namely, in the data conversion apparatuses heretofore, there tended to be the disadvantage that the number of entries was not sufficient despite the unnecessarily high precision etc., so there was a disadvantage in that it was difficult to effectively use the memory and carry out the processing using suitable indexes for the application.
As a result, in various processing apparatuses to which such a data conversion apparatus is applied, there has been a disadvantage in that suitable processing could not be carried out.
For example, when this data conversion apparatus is applied to processing for generating an image etc., the disadvantages having arisen that the number of usable colors has not been sufficient and therefore discrimination by color could not be suitably achieved and that the display of fine tones of color was not possible and therefore the desired image could not be displayed.
An object of the present invention is to provide a data conversion apparatus that can suitably change the precision of the index table with respect to an entry and the number of entries according to need and that can suitably carry out the conversion from index data to real data in a desired format suited to the application.
Further, another object of the present invention is to provide an image generation apparatus which can suitably change the precision of the index table with respect to an entry and the number of entries in accordance with the type of the image data to be processed etc., which can thereby convert from index color to real color in the desired format suited to the application, and which can suitably generate the intended image.
So as to achieve the objects, the present invention provides a data conversion apparatus comprising a first memory and a second memory each for storing data having a n bit width and in which any data is stored, an address detecting means for detecting addresses of the first memory and the second memory based on input data at which data corresponding to the input data are stored, a data reading means for reading data stored at the detected addresses of the first memory and the second memory, a first data selecting means for selecting either of the data read from the first memory or the data read from the second memory based on the input data, a data extending means for extending the selected data to data having a 2xc3x97n bits width, and a second data selecting means for selecting either of the first data formed by connecting the data output from the first memory and the data output from the second memory or the second data of the extended data based on an input selection signal and outputting data selected by the second data selecting means with respect to the input of the data.
Preferably, the address detecting means adds the input data and a predetermined base address to detect the address at which the corresponding data is stored.
Specifically, the first memory and the second memory store real color data, the address detecting means is input index color data given corresponding to real color data to be read, and the index color data is converted to real color data.
Further specifically, said real color data is data having red luminance data, green luminance data, blue luminance data, and transparency data.
Further specifically, the first memory and the second memory are memories each storing data having a 16 bits width, the real color data is 32 bits width data having 8 bits each of red luminance data, green luminance data, blue luminance data, and transparency data or 16 bits width data of 5 bits, 5 bits, 5 bits, and 1 bit, the data extending means extends the selected data to 32 bits width real color data when the read data is the 16 bits width real color data, and the second data selecting means selects the 32 bits width real color data formed by connecting the data output from the first memory and the data output from the second memory when the read data is 32 bits width real color data and selects the extended 32 bits width real color data when the read data is 16 bits width real color data.
Preferably, a data width of the input data is smaller than n bits.
Further preferably, the first memory, the second memory, the address detecting means, the data reading means, the first data selecting means, the data extending means, and the second data selecting means are comprised in an integrated circuit.
Further, so as to achieve the objects, the present invention provides an image generation apparatus comprising a coordinate transforming means for carrying out a predetermined coordinate transformation with respect to vertexes of basic polygons of three-dimensional image data by which any three-dimensional cubic model may be shown as a set of basic polygons indicated by vertexes having at least three-dimensional position information, a pixel data generating means for generating pixel data of the basic polygons based on the data of vertexes of the basic polygons, a data conversion apparatus which converts texture index data to real texture data for carrying out texture mapping with respect to the generated each pixel data, a texture mapping means for generating display use three-dimensional image data by carrying out texture mapping with respect to the generated pixel data by using the converted real texture data, an image memory for storing the generated three-dimensional image data as display use image data, and an outputting means for reading data of a desired region from among the stored display use image data and outputting the same as display use screen data, the data conversion apparatus comprising a first memory and a second memory each for storing data having n bits width and in which real texture data is stored, an address detecting means for detecting addresses of the first memory and the second memory based on input index texture data at which real texture data corresponding to the input index texture data are stored, a data reading means for reading real texture data stored at the detected addresses of the first memory and the second memory, a first data selecting means for selecting either of the real texture data read from the first memory or the real texture data read from the second memory based on the input index texture data, a data extending means for extending the selected data to data having a 2xc3x97n bits width, and a second data selecting means for selecting either of the first data formed by connecting the real texture data output from the first memory and the real texture data output from the second memory or the second data of the extended data based on an input selection signal and outputting real texture data with respect to the input of index texture data.
Preferably, the address detecting means adds the input index texture data and a predetermined base address of the index table to detect the address at which the real texture data is stored.